package 实验.实验七;

import java.util.*;

public class Agricultural {
    public static void main(String[] args) {
        List<Double> rice = new ArrayList<>();
        Double riceMoney =0.0;
        rice.add(50.20);
        rice.add(29.58);
        rice.add(20.32);
        Iterator<Double> iterator = rice.iterator();
        while (iterator.hasNext()) {
            riceMoney += iterator.next();
        }
        List<Double> wheat = new ArrayList<>();
        Double wheatMoney =0.0;
        wheat.add(13.12);
        wheat.add(66.66);
        wheat.add(10.12);
        Iterator<Double> wheatwheat = wheat.iterator();
        while (wheatwheat.hasNext()){
            wheatMoney += wheatwheat.next();
        }
        List<Double> corn =  new ArrayList<>();
        Double cornMoney =0.0;
        corn.add(13.12);
        corn.add(66.66);
        corn.add(10.12);
        Iterator<Double> cornIterator = corn.iterator();
        while (cornIterator.hasNext()){
            cornMoney += cornIterator.next();
        }
        Map<String,Double> budget = new HashMap<>();
        budget.put("水稻",riceMoney);
        budget.put("小麦",wheatMoney);
        budget.put("玉米",cornMoney);
        Iterator<String> budgetIterator =budget.keySet().iterator();
        Double total =0.0;
        System.out.println("_________本季度总费用__________");
        while(budgetIterator.hasNext()){
        String key = budgetIterator.next();
        System.out.println(key+"本季度一共报销了:"+budget.get(key)+"元");
        total += budget.get(key);
        }
        System.out.println("________________________");
        System.out.println("合计：本年度农业部门一共花费了"+total+"元");
    }
}
